﻿Public Class UserModel
    Private _name, _id As String

    Public Sub New(name As String, id As String)
        _name = name
        _id = id
    End Sub

    Public Property CanReadOrder As Boolean
    Public Property CanWriteOrder As Boolean
    Public Property CanReadArticle As Boolean
    Public Property CanWriteArticle As Boolean
    Public Property CanReadCustomer As Boolean
    Public Property CanWriteCustomer As Boolean
    Public Property CanReadDatabase As Boolean
    Public Property CanWriteDatabase As Boolean
    Public Property CanEditUsers As Boolean

    Public ReadOnly Property Name As String
        Get
            Return _name
        End Get
    End Property
    Public ReadOnly Property ID As String
        Get
            Return _id
        End Get
    End Property

    Public Shared Function FromUserPreviewModel(s As FuncClasses.nHibernate.Models.UserPreviewModel)
        Return New UserModel(s.UserName, s.UserID) With {.CanReadOrder = s.CanReadOrder, .CanWriteOrder = s.CanWriteOrder, .CanReadArticle = s.CanReadArticle, .CanWriteArticle = s.CanWriteArticle, _
                                                         .CanReadCustomer = s.CanReadCustomer, .CanWriteCustomer = s.CanWriteCustomer, .CanReadDatabase = s.CanReadDatabase, _
                                                         .CanWriteDatabase = s.CanWriteDatabase, .CanEditUsers = s.CanEditUsers}
    End Function
End Class
